package com.rao.mideng.core;


import com.rao.mideng.utils.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import javax.servlet.http.HttpServletRequest;


@Slf4j
public class LogInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        HttpServletRequest request = HttpRequestUtil.httpServletRequest();
        //请求的url
        String url = request.getRequestURI();
        log.info("current-url----{},current-method===={}", url, invocation.getMethod().toString());
        return invocation.proceed();
    }
}
